if(typeof String.prototype.trim !== 'function') { 
  String.prototype.trim = function() { 
    return this.replace(/^\s+|\s+$/, '');  
  }; 
};		

zxt.type.Mode = {
	VIEW	:	"view",
	EDIT	:	"edit",
	CRET  : "cret"
};

/**
 * @namespace 操作列表
 */
zxt.type.Operation = {
	
	/**
	 * 新建操作
	 * @memberOf
	 */
	CREATE		:	"create",
	
	/**
	 * 编辑操作
	 * @memberOf
	 */
	EDIT			:	"edit",
	
	/**
	 * 删除操作
	 * @memberOf
	 */
	DELETE		:	"del",
	
	/**
	 * 保存操作
	 * @memberOf
	 */
	SAVE			: "save",
	
	/**
	 * 取消操作
	 * @memberOf
	 */
	CANCEL		: "cancel",
	
	/**
	 * 查询操作
	 * @memberOf
	 */
	QUERY			: "query",
	
	/**
	 * 重置操作
	 * @memberOf
	 */
	RESET			: "reset"
};


/**
 * zxt框架基础类框架
 */
zxt.clazz = function(){
	
};	

/**
 * zxt框架类继承规则定义
 */
zxt.clazz.prototype.inheritFrom = function (fnClass /*: Function */) /*:void*/ {
		
		    /**
		     * Inherits all classes going up the inheritance chain recursively.
		     * @param fnClass The class to inherit from.
		     * @param arrClasses The array of classes to build up.
		     * @scope private
		     */
		    function inheritClasses(fnClass /*:Function*/, 
		                            arrClasses /*:Array*/) /*:void*/ {
		        
		        arrClasses.push(fnClass);
		
		        if (typeof fnClass.__superclasses__ == "object") {
		            for (var i=0; i < fnClass.__superclasses__.length; i++){
		                inheritClasses(fnClass.__superclasses__[i], arrClasses);
		            }
		        }
		    }
		    if (typeof this.constructor.__superclasses__ == "undefined") {
		        this.constructor.__superclasses__ = new Array();
		    }
		    
		    inheritClasses(fnClass, this.constructor.__superclasses__);
		    
		    for (var prop in fnClass.prototype) {
		    	if ( prop !="constructor" ){
			        if (typeof fnClass.prototype[prop] == "function" || true) {
			            this[prop] = fnClass.prototype[prop];
			        }
		      	}  
		    }
};
		
/**
 * Determines if the given object is an instance of a given class.
 * This method is necessary because using {@link #inheritFrom} renders
 * the JavaScript <code>instanceof</code> operator useless.
 * @param fnClass The constructor function to test.
 * @return True if the object is an instance of the class, false if not.
 * @scope public
 */
zxt.clazz.prototype.instanceOf = function (fnClass /*:Function*/) /*: boolean */ {

    if (this.constructor == fnClass) {
        return true;
    } else if (typeof this.constructor.__superclasses__ == "object") {
        for (var i=0; i < this.constructor.__superclasses__.length; i++) {
            if (this.constructor.__superclasses__[i] == fnClass) {
                return true;
            }
        }
        return false;
    } else {
        return false;
    }
};


/**
 * 定义类的继承方法,fn继承自参数数组中的其他父类函数
 */
zxt.defineClazz = function(fn){	
	fn.prototype = new zxt.clazz();
	fn.prototype.constructor = fn;
	var base = arguments;
	for(var i=1; i<base.length; i++){
		fn.prototype.inheritFrom(base[i]);
	}		
};	

/**
 * ZXT框架基础组件类
 */
zxt.core.Component = function(id){	
	this._id = id;
};

zxt.core.Component.prototype = new zxt.clazz();

/**
 * <p>
 * 返回组件类型
 * </p>
 * <p>
 * 子类必须覆盖该方法, 以返回正确的值。
 * </p>
 * 
 * @function
 * @returns {string} 组件类型
 */
zxt.core.Component.prototype.getType = function(){
	return "zxt.core.Component";
};

/**
 * [GETTER] 控件的ID
 * 
 * @type string
 * @function
 */
zxt.core.Component.prototype.id = function(v){
	if (v === undefined) {	return this._id;	}
  this._id = v;	
};

zxt.core.Component.prototype._config = function(conf) {
	for( var k in conf ){
		if ( zxt.util.stringStartWith(k, "_") || zxt.util.stringStartWith(k, "$") ){
		} else {	
			var v = conf[k];			
			this.field(k,v);
		}
	};
};	


/**
 * 设置控件的的配置属性
 * 
 * @param 配置的键值对
 */
zxt.core.Component.prototype.config = function(conf) {
	this._config(conf);
};	

/**
 * @private
 *	set/get 控件的属性
 */
zxt.core.Component.prototype.field = function(property, value) {
	var field = "$" + property;
	if (typeof value == "undefined")
		return this[field];

	//if( this[field] === undefined ){ return; }
	this[field] = value;
	return this;
};

/**
 * @private
 */
zxt.core.Component.prototype.fieldWithDefault = function(k, v, d) {
	var ret = this.field(k, v);
	if (v == undefined && ret == undefined)
		return d;
	return ret;
};


